import numpy as np

a = np.array([10, 20, 30, 40])
b = np.arange(4)

print(a, b)

c = a - b  # array([10, 19, 28, 37])
d = a + b  # array([10, 21, 32, 43])
e = a * b  # array([  0,  20,  60, 120])

print(c)
print(d)
print(e)

# array([-5.44021111,  9.12945251, -9.88031624,  7.4511316 ])
c = 10 * np.sin(a)
print("********")

a = np.array([[1, 1], [0, 1]])
# 其中 reshape 操作是对矩阵的形状进行重构，
# 其重构的形状便是括号中给出的数字。
b = np.arange(4).reshape((2, 2))

print(a)
# array([[1, 1],
#       [0, 1]])

print(b)
# array([[0, 1],
#       [2, 3]])
print("********")
c_dot = np.dot(a,b)
# array([[2, 4],
#       [2, 3]])
print(c_dot)
print("********")
c_dot_2 = a.dot(b)
# array([[2, 4],
#       [2, 3]])
print(c_dot_2)
